package it.nard.sourceframes;

import it.nard.controller.BasicController;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.TitledBorder;

import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;
import org.jdesktop.swingx.JXDatePicker;
import org.jfree.chart.ChartPanel;

//VS4E -- DO NOT REMOVE THIS LINE!
public class AnalisiProduzionePnl extends JPanel {

	private static final long serialVersionUID = 1L;
	private JCheckBox jCheckBox0;
	private JLabel jLabel1;
	private JXDatePicker jXDatePicker1;
	private JXDatePicker jXDatePicker0;
	private JLabel jLabel0;
	private JCheckBox jCheckBox1;
	private JCheckBox jCheckBox2;
	private JPanel jPanel0;
	private ChartPanel jPanel1;
	private JButton jButton0;
	private BasicController basicController;
	private JRadioButton jRadioButton0;
	private JRadioButton jRadioButton1;
	private JRadioButton jRadioButton2;

	public AnalisiProduzionePnl() {
		initComponents();
	}
	public AnalisiProduzionePnl(BasicController bc){
		initComponents();
		basicController = bc;
	}

	private void initComponents() {
		setLayout(new GroupLayout());
		add(getJPanel0(), new Constraints(new Leading(4, 791, 10, 10), new Leading(6, 591, 10, 10)));
		setSize(800, 600);
	}

	public JRadioButton getJRadioButton2() {
		if (jRadioButton2 == null) {
			jRadioButton2 = new JRadioButton();
			jRadioButton2.setText("Mensile");
		}
		return jRadioButton2;
	}
	public JRadioButton getJRadioButton1() {
		if (jRadioButton1 == null) {
			jRadioButton1 = new JRadioButton();
			jRadioButton1.setText("Settimanale");
		}
		return jRadioButton1;
	}
	public JRadioButton getJRadioButton0() {
		if (jRadioButton0 == null) {
			jRadioButton0 = new JRadioButton();
			jRadioButton0.setText("Giornaliero");
		}
		return jRadioButton0;
	}
	private JButton getJButton0() {
		if (jButton0 == null) {
			jButton0 = new JButton();
			jButton0.setText("Analizza");
			jButton0.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jButton0ActionActionPerformed(event);
				}
			});
		}
		return jButton0;
	}

	public ChartPanel getJPanel1() {
		if (jPanel1 == null) {
			
	        
			jPanel1 = new ChartPanel(null);
	
			jPanel1.setLayout(new GroupLayout());
		}
		return jPanel1;
	}

	private JPanel getJPanel0() {
		if (jPanel0 == null) {
			jPanel0 = new JPanel();
			jPanel0.setBorder(BorderFactory.createTitledBorder(null, "Analisi Produzione", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, null, null));
			jPanel0.setLayout(new GroupLayout());
			jPanel0.add(getJXDatePicker1(), new Constraints(new Leading(401, 10, 10), new Leading(-4, 12, 12)));
			jPanel0.add(getJXDatePicker0(), new Constraints(new Leading(136, 10, 10), new Leading(-4, 12, 12)));
			jPanel0.add(getJCheckBox2(), new Constraints(new Leading(189, 86, 10, 10), new Leading(26, 12, 12)));
			jPanel0.add(getJCheckBox1(), new Constraints(new Leading(102, 86, 10, 10), new Leading(26, 12, 12)));
			jPanel0.add(getJCheckBox0(), new Constraints(new Leading(2, 10, 10), new Leading(26, 12, 12)));
			jPanel0.add(getJPanel1(), new Constraints(new Leading(2, 773, 12, 12), new Leading(52, 511, 10, 10)));
			jPanel0.add(getJLabel1(), new Constraints(new Leading(294, 105, 10, 10), new Leading(-2, 12, 12)));
			jPanel0.add(getJLabel0(), new Constraints(new Leading(7, 10, 10), new Leading(0, 12, 12)));
			jPanel0.add(getJButton0(), new Constraints(new Leading(604, 101, 10, 10), new Leading(-4, 28, 12, 12)));
			jPanel0.add(getJRadioButton0(), new Constraints(new Leading(429, 10, 10), new Leading(26, 12, 12)));
			jPanel0.add(getJRadioButton1(), new Constraints(new Leading(526, 106, 10, 10), new Leading(26, 12, 12)));
			jPanel0.add(getJRadioButton2(), new Constraints(new Leading(631, 106, 10, 10), new Leading(28, 12, 12)));
		}
		return jPanel0;
	}
	public JCheckBox getJCheckBox2() {
		if (jCheckBox2 == null) {
			jCheckBox2 = new JCheckBox();
			jCheckBox2.setText("Ricotta");
		}
		return jCheckBox2;
	}

	public JCheckBox getJCheckBox1() {
		if (jCheckBox1 == null) {
			jCheckBox1 = new JCheckBox();
			jCheckBox1.setText("Provola");
		}
		return jCheckBox1;
	}

	private JLabel getJLabel0() {
		if (jLabel0 == null) {
			jLabel0 = new JLabel();
			jLabel0.setText("Data Inizio Periodo");
		}
		return jLabel0;
	}

	public JXDatePicker getJXDatePicker0(){
	if(jXDatePicker0==null){
	jXDatePicker0 = new JXDatePicker();
		}
	return jXDatePicker0;
	}

	public JXDatePicker getJXDatePicker1(){
	if(jXDatePicker1==null){
	jXDatePicker1 = new JXDatePicker();
		}
	return jXDatePicker1;
	}

	private JLabel getJLabel1() {
		if (jLabel1 == null) {
			jLabel1 = new JLabel();
			jLabel1.setText("Data Fine Periodo");
		}
		return jLabel1;
	}

	public JCheckBox getJCheckBox0() {
		if (jCheckBox0 == null) {
			jCheckBox0 = new JCheckBox();
			jCheckBox0.setText("Mozzarella");
		}
		return jCheckBox0;
	}

	private void jButton0ActionActionPerformed(ActionEvent event) {
		this.basicController.onDateSelect();
	}

}
